da59fc6a6180e6a89a1773df9266a9e9edf2e733,applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java,IcsPaymentServices,ccRefund,#DispatchContext#Map#,168
Before Change
// transmit the request
Map reply;
try {
reply = Client.runTransaction(request, props);
} catch (FaultException e) {
Debug.logError(e, "ERROR: Fault from CyberSource", module);
return ServiceUtil.returnError("Unable to communicate with CyberSource");
After Change
}
public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, ? extends Object> context) {
GenericDelegator delegator = dctx.getDelegator();
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
if (authTransaction == null) {
return ServiceUtil.returnError("No authorization transaction found for the OrderPaymentPreference; cannot refund");
}
// generate the request/properties
Properties props = buildCsProperties(context, delegator);
if (props == null) {
return ServiceUtil.returnError("ERROR: Getting Cybersource property configuration");
}
Map<String, Object> request = buildRefundRequest(context, authTransaction, delegator);
request.put("merchantID", props.get("merchantID"));
// transmit the request
Map<String, Object> reply;
try {
reply = UtilGenerics.cast(Client.runTransaction(request, props));
} catch (FaultException e) {
Debug.logError(e, "ERROR: Fault from CyberSource", module);
return ServiceUtil.returnError("Unable to communicate with CyberSource");